import request from '@/utils/request'

// 查询资费管理列表
export function listFee(query) {
  return request({
    url: '/system/fee/list',
    method: 'get',
    params: query
  })
}
export function listFeeByOperator(orgId,operator) {
  return request({
    url: '/card/warehousing/list?orgId='+orgId+'&operator=' + operator,
    method: 'get',
  })
}

export function listFeeById(id) {
  return request({
    url: '/card/warehousing/list?id=' + id,
    method: 'get',
  })
}

// 查询资费管理详细
export function getFee(id) {
  return request({
    url: '/system/fee/' + id,
    method: 'get'
  })
}
// 查询资费管理详细
export function getOperator(data) {
  return request({
    url: "/card/warehousing/ip/operator",
    method: "post",
    data:data
  });
}
// 上架资费管理
export function upFee(data) {
  return request({
    url: '/system/fee',
    method: 'post',
    data: data
  })
}
// 下架资费管理
export function downFee(data) {
  return request({
    url: '/system/fee/down',
    method: 'post',
    data: data
  })
}

// 修改资费管理
export function updateFee(data) {
  return request({
    url: '/system/fee',
    method: 'put',
    data: data
  })
}

// 删除资费管理
export function delFee(id) {
  return request({
    url: '/system/fee/' + id,
    method: 'delete'
  })
}

// 运营商 运营商平台联动
export function getcarrierPlatforms(operator) {
  let res
if (operator==null||operator==undefined) {
  res=-1
} else{
  res=operator
}
  console.log(operator)
  return request({
    url: `/system/dict/data/operator/${res}`,
    method: 'get'
  })
}


// 获取机构树
export function getTree() {
  return request({
    url: '/system/fee/service',
    method: 'get'
  })
}
//资费上架树形结构
export function gettoTree() {
  return request({
    url: 'system/org/list/orgBusiness/v2',
    method: 'get'
  })
}
